package com.upf1sh.utils;

import com.upf1sh.utils.UUID.Constants;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class ResourcesConfig implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry){

        // 打印日志检查路径
        System.out.println("Resource Prefix: " + Constants.RESOURCE_PREFIX);
        System.out.println("Profile Path: " + SYSConfig.getProfile());


        /** 本地文件上传路径 */
        registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**")
                .addResourceLocations("file:" + SYSConfig.getProfile() + "/");
    }

}
